<template>
  <el-form ref="formRef" :model="student" label-width="120px">
    <el-form-item label="学生号">
      <el-input v-model="student.studentId"></el-input>
    </el-form-item>
    <el-form-item label="学生名">
      <el-input v-model="student.studentName"></el-input>
    </el-form-item>
    <el-form-item label="学生性别">
      <el-switch
          v-model="student.studentSex"
          :active-icon="Male"
          :inactive-icon="Female"
          active-color="#409EFF"
          inactive-color="#E6A23C"
          active-value="1"
          inactive-value="0"/>
    </el-form-item>
    <el-form-item label="用户编号">
      <el-input v-model="student.userId"></el-input>
    </el-form-item>
    <el-form-item label="专业编号">
      <el-input v-model="student.majorId"></el-input>
    </el-form-item>
    <el-form-item label="学生状态">
      <el-switch
          v-model="student.status"
          active-text="启用"
          inactive-text="停用"
          active-color="#13ce66"
          inactive-color="#ff4949"
          active-value="0"
          inactive-value="2"/>
    </el-form-item>
    <el-form-item>
      <el-button @click="add()">添加</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import {Female,Male} from "@element-plus/icons-vue";
</script>

<script>
import {addStudent} from "@/api/student";
export default {
  name: "AddStudent",
  data(){
    return{
      students:[],
      student:{
        studentId:'',
        studentName:'',
        studentSex:0,
        status:0,
        userId:'',
        majorId:'',
      }
    }
  },
  methods:{
    async add(){
      const rep = await addStudent(this.student)
      console.log(rep)
    }
  }
}
</script>

<style scoped>

</style>